package com.ruoyi.crm.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.crm.mapper.ServiceRevisitMapper;
import com.ruoyi.crm.domain.ServiceRevisit;
import com.ruoyi.crm.service.IServiceRevisitService;

/**
 * 服务回访单Service业务层处理
 *
 * @author ruoyi
 * @date 2021-08-30
 */
@Service
public class ServiceRevisitServiceImpl implements IServiceRevisitService
{
    @Autowired
    private ServiceRevisitMapper serviceRevisitMapper;

    /**
     * 查询服务回访单
     *
     * @param id 服务回访单主键
     * @return 服务回访单
     */
    @Override
    public ServiceRevisit selectServiceRevisitById(String id)
    {
        return serviceRevisitMapper.selectServiceRevisitById(id);
    }

    /**
     * 查询服务回访单列表
     *
     * @param serviceRevisit 服务回访单
     * @return 服务回访单
     */
    @Override
    public List<ServiceRevisit> selectServiceRevisitList(ServiceRevisit serviceRevisit)
    {
        return serviceRevisitMapper.selectServiceRevisitList(serviceRevisit);
    }

    /**
     * 新增服务回访单
     *
     * @param serviceRevisit 服务回访单
     * @return 结果
     */
    @Override
    public int insertServiceRevisit(ServiceRevisit serviceRevisit)
    {
        return serviceRevisitMapper.insertServiceRevisit(serviceRevisit);
    }

    /**
     * 修改服务回访单
     *
     * @param serviceRevisit 服务回访单
     * @return 结果
     */
    @Override
    public int updateServiceRevisit(ServiceRevisit serviceRevisit)
    {
        serviceRevisit.setUpdateTime(DateUtils.getNowDate());
        return serviceRevisitMapper.updateServiceRevisit(serviceRevisit);
    }

    /**
     * 批量删除服务回访单
     *
     * @param ids 需要删除的服务回访单主键
     * @return 结果
     */
    @Override
    public int deleteServiceRevisitByIds(String[] ids)
    {
        return serviceRevisitMapper.deleteServiceRevisitByIds(ids);
    }

    /**
     * 删除服务回访单信息
     *
     * @param id 服务回访单主键
     * @return 结果
     */
    @Override
    public int deleteServiceRevisitById(String id)
    {
        return serviceRevisitMapper.deleteServiceRevisitById(id);
    }

    @Override
    public ServiceRevisit getInfoByRevisitNo(String revisitNo) {
        return serviceRevisitMapper.getInfoByRevisitNo(revisitNo);
    }
}